package com.sina.shop.domain.goods;

import com.sina.shop.core.domain.Domain;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.Min;

/**
 * Created with IntelliJ IDEA.
 * Description: 商品评论图片实体类
 * 段浩杰   2017-12-11-10:55
 */
@Entity
@Table(name = "tb_goods_comment_photo")
@DynamicInsert
@DynamicUpdate
public class GoodsCommentPhoto extends Domain {

    @Id
    @Column(name = "id", updatable = false)
    @GenericGenerator(name = "sequence_id", strategy = "com.sina.shop.sequence.IdGenerator")
    @GeneratedValue(generator = "sequence_id")
    @Min(1)
    private Long id;//主键

    @ManyToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
    @JoinColumn(name = "gcid")
    private GoodsComment goodsComment;//评论实体类

    @Column(name = "url", length = 50)
    private String url;//图片url

    @Column(name = "sort", length = 5)
    private Integer sort;//排序


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public GoodsComment getGoodsComment() {
        return goodsComment;
    }

    public void setGoodsComment(GoodsComment goodsComment) {
        this.goodsComment = goodsComment;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }
}
